//
//  IndexConfigInterface.h
//  ChartRefactor
//
//  Created by CaoJun on 15/3/24.
//  Copyright (c) 2015年 CaoJun. All rights reserved.
//

#ifndef __ChartRefactor__IndexConfigInterface__
#define __ChartRefactor__IndexConfigInterface__

#include "IndexConfig.h"

#include <utility>
#include <map>
#include <string>

namespace ytx{
    class IndexConfigInterface
    {
    protected:
        std::map<IndexType::IndexType, IndexConfig> indexConfigs;
    public:
        LineType::LineType indexQuotationType;
        
        std::string indexId;
        
        IndexConfigInterface(std::string indexId, LineType::LineType indexQuotationType);
        
        static std::string IndexConfigUserDefaultKey;
        
        virtual void setIndexConfig(std::map<IndexType::IndexType, IndexConfig> indexConfigs);
        
        virtual void setIndexConfig(IndexConfig indexConfig);
        
        virtual std::map<IndexType::IndexType, IndexConfig> getIndexConfigs();
        
        virtual IndexConfig & getIndexConfig(IndexType::IndexType type);
        
        virtual void saveIndexConfigToUserDefault(IndexType::IndexType type);
        
        virtual void clearIndexConfigToUserDefault(IndexType::IndexType type);
        
        virtual void resetIndexConfigToConfigDefault(IndexType::IndexType type);
        
        virtual IndexConfig getIndexConfigToUserDefault(IndexType::IndexType type);
        
        virtual void setIndexConfigByUserDefaultOrGivenValue(std::map<IndexType::IndexType, IndexConfig> indexConfigs);
        
        virtual void loadIndexConfigByUserDefault();
        
        void clearAllIndexPermission();
        void addIndexPermission(IndexType::IndexType indexType, int indexPermission);
        
        std::pair<bool, IndexConfig> haveParticularIndexAndHas();
        
        virtual std::string getUserDefaultKey(IndexType::IndexType type);
    };
}

#endif /* defined(__ChartRefactor__IndexConfigInterface__) */
